﻿using NORM.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DevelopAssistant.Service
{
    public class DeleteTable : SnippetBase
    {
        public static string ToSnippetCode(string TableName, DataBaseServer DatabaseServer)
        {
            StringPlus sp = new StringPlus();

            sp.Append("DELETE FROM " + getObject(TableName, DatabaseServer.ProviderName) + "").Append(Environment.NewLine);
            switch (DatabaseServer.ProviderName)
            {
                case "System.Data.Sql":
                case "System.Data.SQL":
                    sp.Append("TRUNCATE  TABLE  " + getObject(TableName, DatabaseServer.ProviderName) + "").Append(Environment.NewLine);       
                    break;
            }            
            sp.Append("GO");

            return sp.Value;
        }
    }
}
